﻿'<Get Linux is a open source lightweight download client for operating systems.>
'    Copyright (C) <2014>  <Dev-fire>

'    This program is free software: you can redistribute it and/or modify
'    it under the terms of the GNU General Public License as published by
'    the Free Software Foundation, either version 3 of the License, or
'    (at your option) any later version.

'    This program is distributed in the hope that it will be useful,
'    but WITHOUT ANY WARRANTY; without even the implied warranty of
'    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'    GNU General Public License for more details.

'    You should have received a copy of the GNU General Public License
'    along with this program.  If not, see <http://www.gnu.org/licenses/>.
Public Class Debug
    'Closing
    Private Sub Debug_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        'Dont Allow Closing
        If Main.Visible = True And Me.Visible = True Then
            Me.Hide()
            e.Cancel = True
        End If
    End Sub
    'Onload
    Private Sub Debug_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Variables()
    End Sub
    'Variables
    Public Sub Variables()
        'Time Stamp
        TextBox_Variables.Text = "<" & Now.ToString("hh:mm:ss.fff tt") & "> " & vbCrLf
        'Main.OS Download Path
        If Main.OS_Download_Path = Nothing Then
            TextBox_Variables.AppendText("Main.OS_Download_Path =" & vbCrLf & vbCrLf)
        Else
            TextBox_Variables.AppendText("Main.OS_Download_Path = " & Main.OS_Download_Path.ToString & vbCrLf & vbCrLf)
        End If
        '---
        'Main.Selected OS
        If Main.Selected_OS = Nothing Then
            TextBox_Variables.AppendText("Main.Selected_OS =" & vbCrLf)
        Else
            TextBox_Variables.AppendText("Main.Selected_OS = " & Main.Selected_OS.ToString & vbCrLf)
        End If
        'Main.Website
        If Main.Website = Nothing Then
            TextBox_Variables.AppendText("Main.Website =" & vbCrLf)
        Else
            TextBox_Variables.AppendText("Main.Website = " & Main.Website.ToString & vbCrLf)
        End If

        'Main.Download 32
        If Main.Download_32 = Nothing Then
            TextBox_Variables.AppendText("Main.Download_32 =" & vbCrLf)
        Else
            TextBox_Variables.AppendText("Main.Download_32 = " & Main.Download_32.ToString & vbCrLf)
        End If

        'Main.Download 64
        If Main.Download_64 = Nothing Then
            TextBox_Variables.AppendText("Main.Download_64 =" & vbCrLf)
        Else
            TextBox_Variables.AppendText("Main.Download_64 = " & Main.Download_64.ToString & vbCrLf)
        End If

        'Main.OS Download
        If Main.OS_Download = Nothing Then
            TextBox_Variables.AppendText("Main.OS_Download =" & vbCrLf & vbCrLf)
        Else
            TextBox_Variables.AppendText("Main.OS_Download = " & Main.OS_Download.ToString & vbCrLf & vbCrLf)
        End If
        '---
        'Main.TotalFileSize
        If Main.TotalFileSize = Nothing Then
            TextBox_Variables.AppendText("Main.TotalFileSize =" & vbCrLf & vbCrLf)
        Else
            TextBox_Variables.AppendText("Main.TotalFileSize = " & Main.TotalFileSize.ToString & vbCrLf & vbCrLf)
        End If
        '---
        'Main.OSs Downloading
        If Main.OSs_Downloading.Count < 0 Then
            TextBox_Variables.AppendText("Main.OSs_Downloading =" & vbCrLf)
        Else
            Dim os() As String = CType(Main.OSs_Downloading.ToArray(Type.GetType("System.String")), String())
            Dim oss As String
            oss = Join(os, ", ") ' join the strings
            TextBox_Variables.AppendText("Main.OSs_Downloading = " & oss & vbCrLf)
        End If
    End Sub
    'Action Log Changed
    Private Sub TextBox_Action_Log_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox_Action_Log.TextChanged
        Variables()
    End Sub
End Class